Make rtrim work sensibly when passed null pointers or pointers to empty
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 3 Jun 2003 18:14:29 +0000 (18:14 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 3 Jun 2003 18:14:29 +0000 (18:14 +0000)
strings.

gpsbabel/util.c

index 52cfb4c19144f62ec1262cc6285bd501d858dd83..06656b4e0c3fea952e68e07a38980aadd416a2da 100644 (file)
@@ -194,6 +194,10 @@ pstrdup(char *src)
 void 
 rtrim(char *s)
 {
+       if (!s || !*s) {
+               return;
+       }
+
        while (*s) {
                s++;
        }